package com.aaa.controller;

import com.aaa.service.CheckService;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

@RequestMapping("check")
@RestController
public class CheckController {
    @Resource
    private CheckService checkService;
    @RequestMapping("addcheck")
    public Integer addcheck(Authentication authentication, Integer odid, String enddate, String cname, String cphone, String idcard, Integer oid, Integer rid){
        Date date=new Date();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String checkin=sdf.format(date);
        System.out.println(checkin);
        return checkService.addcheck(authentication,odid,enddate,cname,cphone,idcard,checkin,oid,rid);
    }
}
